#pragma once
#include <lcir/IR/Context.h>
#include <string>
namespace lcir {
// 自定义dialect，需要提供无参构造，并且调用父类构造函数设置dialect名
class Dialect {
  std::string name{""};

public:
  Dialect(std::string_view name) : name{name} {}
  virtual ~Dialect() = default;
  std::string getName() const { return name; }
};

template <class DerivedTy> class DialectCRTP : public Dialect {
public:
  DialectCRTP(std::string_view name) : Dialect{name} {}
  static  DerivedTy *get() {
		auto* context = GlobalContext::get();
		return context->getDialect<DerivedTy>();
	}
};
} // namespace lcir